package com.xxx.sql;

import org.apache.ibatis.jdbc.SQL;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/8/13 14:35
 * @Copyright 博为峰
 */
public class UserSqlBuilder {
    public String buildGetUsersByName(String name) {
        return new SQL(){{
            SELECT("*");
            FROM("user");
            if (name != null) {
                WHERE("name like #{value} || '%'");
            }
            ORDER_BY("id");
        }}.toString();
    }
}
